//管理用户数据相关
import { defineStore } from 'pinia'
import { postUserLoginApi } from "@/apis/user";
import { ref } from 'vue'
export const useUserStore = defineStore('user', () => {
    //定义state
    const userInfo = ref({})
    //定义获取接口数据的action函数
    const getUserInfo = async (account, password) => {
        const res = await postUserLoginApi(account, password)
        userInfo.value = res.data
    }
    const clearUserInfo =()=>{
        userInfo.value = {}
    }
    return { userInfo, getUserInfo, clearUserInfo}
},
// 持久化配置
    {
        persist: true
    }
)